	#@head() 
	#define paginate(currentPage, totalPage, link)
	#if(totalPage <= 0 || currentPage > totalPage) #return #end
	#setLocal(startPage = currentPage - 4)
	#if (startPage < 1) #setLocal(startPage = 1) #end
	 
	#setLocal(endPage = currentPage + 4)
	#if (endPage > totalPage) #setLocal(endPage = totalPage) #end
	
	<div class="pagination" style="width:100%" align="center" >
			#if (currentPage <= 8)
				#setLocal(startPage = 1)
			#end     
			#if ((totalPage - currentPage) < 8)
				#setLocal(endPage = totalPage)
			#end  
			  
			#if (currentPage == 1)
				 <button type="button" class="btn btn-default">上页</button>
			#else
				<button type="button" onclick="javascript:window.location.href='#(link)#(currentPage - 1)#(append)' " class="btn btn-default">上页</button> 
			#end
			
			#if (currentPage > 8)
				<button type="button" onclick="javascript:window.location.href='#(link)#(1)#(append)' " class="btn btn-default">#(1)</button> 
				<button type="button" onclick="javascript:window.location.href='#(link)#(2)#(append)' " class="btn btn-default">#(2)</button> 
				<span class="gap">…</span>
			#end
			
			#for(i : [startPage..endPage])
				#if (currentPage == i)
					<button type="button" class="btn btn-info">#(i)</button> 
				
				#else
					<button type="button" onclick="javascript:window.location.href='#(link)#(i)#(append)' " class="btn btn-default">#(i)</button> 
				#end
			#end
			
			#if ((totalPage - currentPage) >= 8)
				<span class="gap">…</span>
				<button type="button" onclick="javascript:window.location.href='#(link)#(totalPage - 1)#(append)' " class="btn btn-default">#(totalPage - 1)</button> 
				<button type="button" onclick="javascript:window.location.href='#(link)#(totalPage)#(append)' " class="btn btn-default">#(totalPage)</button> 
			#end
			
			#if (currentPage == totalPage)
				<button type="button" class="btn btn-default">下页</button>
			#else
				<button type="button" onclick="javascript:window.location.href='#(link)#(currentPage + 1)#(append)' " class="btn btn-default">下页</button> 

			#end
	</div>
#end